package com.vq3.digitalizationsoftwareintegrates.Utils.DateUtils;

import com.vq3.digitalizationsoftwareintegrates.Entity.User.MySqlDate;
import com.vq3.digitalizationsoftwareintegrates.Mapper.User.UserMapper;

public class GetMySqlDate {

    public MySqlDate getMySqlDate(UserMapper userMapper) throws Exception{
        MySqlDate mySqlDate = new MySqlDate();
        String date = userMapper.getDate();
        String time = userMapper.getTime();
        String[] strDateArr = date.split("-",3);
        String[] strTimeArr = time.split(":",3);
        for (int i = 0; i < date.length(); i++) {
            mySqlDate.setYeas(Integer.parseInt(strDateArr[0]));
            mySqlDate.setMonth(Integer.parseInt(strDateArr[1]));
            mySqlDate.setDay(Integer.parseInt(strDateArr[2]));
            mySqlDate.setHour(Integer.parseInt(strTimeArr[0]));
            mySqlDate.setMinute(Integer.parseInt(strTimeArr[1]));
            mySqlDate.setSecond(Integer.parseInt(strTimeArr[2]));
        }
        System.out.println(mySqlDate);

        return new MySqlDate();
    }
}
